'[bug]中'
def method(n, m, nums):
    dis = []  # <i, d>
    for i, d in enumerate(nums):
        dis.append([i, d])
    dis.sort(key=lambda x:x[1])
    # print(dis)

    ans = []
    count = m - n + 1  # 需要补充的边数
    front = [0, 0]  # 上一层的主干节点号，层号
    nodes = [[]]
    new_layer = True
    for i, node in enumerate(dis):
        print(f'i:{i}, node:{node}, nodes:{nodes}')
        if node[0] == 0:
            
        if node[1] == front[1] + 1:
            ans.append([node[0], front[0]])
            new_layer = False
        elif node[1] == front[1] + 2:
            # 当层有一个点了，才能下一层
            if new_layer:
                return -1 
            front = dis[i - 1]
            ans.append([node[0], front[0]])
            nodes.append([])
            new_layer = True
        # 中间缺了层
        elif node[1] != 0:
            # print('out1...')
            return -1
        print(f'ans:{ans}')
        if len(ans) == 3:
            _ = 0
            pass

        while count > 0:
            # print(node, ' | ', nodes)
            # 和上层首以外，的所有结点连接
            level = front[1]
            for fno in nodes[level][1:]:
                if count <= 0: break
                ans.append([node[0], fno[0]])
                count -= 1

            # 和本层所有结点连接
            if level + 1 >= len(nodes):
                break 
            for fno in nodes[level + 1][1:]:
                if count <= 0: break
                ans.append([node[0], fno[0]])
                count -= 1

        nodes[-1].append(node)

    
    A = count > 0  
    B = len(ans) > m 
    if A or B:
        return -1
    return ans


n, m = map(int, input().split())
nums = [int(x) for x in input().split()]
ans = method(n, m, nums)
if ans == -1:
    print(-1)
else:
    for an in ans:
        print(an[0] + 1, an[1] + 1)
